<?php
/**
 * Created by PhpStorm.
 * User: 123
 * Date: 2020/4/18
 * Time: 20:11
 */
namespace app\index\controller;

use app\common\controller\Frontend;

/**
 * 关于我控制器
 * Class About
 * @package app\index\controller
 */
class About extends Frontend
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function index()
    {
        $id=!empty($this->request->param('id'))?intval($this->request->param('id')):0;
        if(empty($id)) $this->error('文章不存在！',url('/index'));

        //文章
        $article=db('article')->where('id='.$id)->field('content')->find();
        if(empty($article)) $this->error('文章不存在！',url('/index'));

        //根据当前控制器标识查询顶级导航信息
        $pageInfo=db('navigation')->where('controllername="'.$this->identify.'" and pid=0')->field('title,keywords,description')->find();

        $this->assign('article',$article);
        $this->assign('pageInfo',$pageInfo);
        return $this->view->fetch();
    }

}